package com.ycg.store.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycg.store.common.Result;
import com.ycg.store.pojo.Good;
import com.ycg.store.service.GoodService;
import com.ycg.store.mapper.GoodMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author lenovo
* @description 针对表【good(货品表)】的数据库操作Service实现
* @createDate 2024-05-24 20:04:33
*/
@Service
public class GoodServiceImpl extends ServiceImpl<GoodMapper, Good>
    implements GoodService{

    /**
     * 根据租户id获取货品
     *
     * @param id 租户id
     * @return List<good>
     */
    @Override
    public Result<List<Good>> getByTenantId(String id) {
        LambdaQueryWrapper<Good> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Good::getTenantId,id);
        List<Good> list = list(wrapper);
        return Result.ok(list);
    }
}




